import Request from "@/utils/request";
import { xmlyResData } from "@/type/resType/resType";
import { ALBUM_BRIEF_DETAIL_BIG_INFO, ANCHOR, HEADER_DATA, PROGRAM_INFO, RES_COMMENT, RES_SIMILARITY_ALBUM } from "@/type/resType/detailResType";

class DetailRequest extends Request {
    // 获取详情
    getDetail = (id: number) => this.get<xmlyResData<HEADER_DATA>>({ url: `/m-revision/page/album/v2/queryAlbumPage/${id}` });
    // 节目
    getProgram = (id: number) => this.get<xmlyResData<PROGRAM_INFO>>({
        url: `/m-revision/common/album/queryAlbumTrackRecordsByPage`, params: {
            albumId: id,
            page: 1,
            pageSize: 10,
            asc: true,
            countKeys: "play % 2Ccomment",
            v: 1678361487607
        }
    })
    // 获取主播信息
    getAnchorInfo = (id: number) => {
        return this.get<xmlyResData<ANCHOR>>({
            url: `/m-revision/common/user/queryUserInfo/${id}?userCountKeys=follower`
        })
    }
    // 获取主播信息下的三个item数据
    getAncItemList = (anchorId: number) => {
        return this.get<xmlyResData<ALBUM_BRIEF_DETAIL_BIG_INFO>>({
            url: `/m-revision/common/anchor/queryAnchorAlbumsByPage`,
            params: {
                anchorId,
                page: 1,
                pageSize: 3,
                asc: false
            }
        })
    }
    // 获取用户评论列表数据
    getUserCommentList = (albumId: number) => {
        return this.get<xmlyResData<RES_COMMENT>>({
            url: `/m-revision/common/album/queryAlbumCommentsByPage`,
            params: {
                page: 1,
                pageSize: 10,
                albumId,
                v: 1691374063618
            }
        })
    }
    // 获取相似专辑数据
    getSimilarityAlbumList = (kw: string) => {
        return this.get<xmlyResData<RES_SIMILARITY_ALBUM>>({
            url: `/revision/search/seo`,
            params: {
                kw,
                page: 1,
                rows: 6,
                device: "iPhone",
                condition: "relation",
                spellchecker: true,
                core: "album"
            }
        })
    }
}

export default new DetailRequest();